package com.mceil.mceilbase.adapter;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.mceil.mceilbase.R;
import com.mceil.mceilbase.bean.MainBean;
import com.mceil.mylibrary.tool.StringUtils;

import java.util.List;

public class MainAdapter extends BaseQuickAdapter<MainBean, BaseViewHolder> {
    public MainAdapter(int layoutResId, @Nullable List<MainBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder baseViewHolder, MainBean mainBean) {
        baseViewHolder.setText(R.id.tv_title, StringUtils.isEmpty(mainBean.getTitle())?"标题":mainBean.getTitle());
        baseViewHolder.setImageResource(R.id.iv_icon,mainBean.getSrc());
    }
}
